<script>
export default {
  name: 'drawModel',
  computed: {
    url() {
      return process.env.VUE_APP_API_URL + 'editor?modelId=' + this.$route.params['modelId']
    }
  },
  methods:{
    handleEditorClose(event) {
      if (event.data === 'editor.close') {
        this.$router.push({
          path: `/activiti/model`
        })
      }
    }
  },
  mounted() {
    window.addEventListener('message', this.handleEditorClose)
  },
  beforeDestroy() {
    window.removeEventListener('message', this.handleEditorClose)
  },
  // eslint-disable-next-line
  render(h) {
    return (
      <div class='draw-model' id='drawModel'>
        <iframe class="iframe-template" src={ this.url } frameborder="0"></iframe>
      </div>
    )
  }
}
</script>


<style lang="scss">
.draw-model{
  height: 100%;
  padding: 0 40px;
}
</style>

